<template>
	<view>
		<u-navbar :is-back="true" :is-fixed="true" title="涉农申报列表"></u-navbar>
		<view class="fixed-top bg-white" style="margin-top: 44px;">

			<view class="px-2 mt-2 pb-2 dfes">
				<u-search placeholder="请输入关键字 " height="60" border-color="#8ED0F2" search-icon-color="#8ED0F2"
					bg-color="#fff" v-model="keyword" :action-style="actionStyle"></u-search>
			</view>
			<u-gap height="20" bg-color="#f7f7f7"></u-gap>
		</view>
		<view class=" mt-12 pl-2 pr-2">
<!-- style="height: calc(100vh - 50px);" -->
			<view class="dfex mt-2">
				<view class="tab-item pb-1" v-for="(tab, index) in tabs" :key="index" @click="currentTab = index"
					:class="{ 'active': currentTab === index }">
					{{ tab }}
				</view>
			</view>
			<view class="mt-3 dfex mt-5" v-for="(item, index) in dataList" :key="index">
				<view>
					<view class="dfel">
						<view class="text-BD3124">{{item.name}}</view>
						<view class="ml-2 bg-F5C9C5 text-BD3124 pl-1 pr-1 rounded p">{{item.tir}}</view>
					</view>
					<view class="dfes mt-1">
						<view class="mr-2 p font-12 rounded  bg-FCE07F" v-if="item.text"
							v-for="(ite, indx) in item.text">
							<view class="text-FFC251">{{ite.name}}</view>
						</view>
					</view>
				</view>
				<view class="bg-78AB06 p-1 rounded-circle font-14 text-white">申请查看主体信息</view>
			</view>
		</view>
	</view>
</template>

<script>
	import $H from "@/common/free-lib/request.js";
	export default {
		data() {
			return {
				keyword: '',
				actionStyle: {
					color: '#8ED0F2'
				},
				pageNo: 1,
				pageSize: 10,
				tabs: ['涉农主体列表', '可查看列表'],
				currentTab: 0,
				dataList: []

			}
		},
		computed: {
			currentTabContent() {
				return this.tabContents[this.currentTab];
			}
		},
		onLoad(options) {
			this.getAgricultureList();
		},
		methods: {
			getAgricultureList() {
				uni.showLoading({
					title: '加载中'
				})
				$H.get(
						"/brand/user/upper/agricultureList", {
							pageNo: this.pageNo,
							pageSize: this.pageSize,
						}, {}
					)
					.then((res) => {
						uni.hideLoading()
						if (res.result.records.length == 0) {
							uni.showToast({
								title: "没有更多啦！",
								icon: "success",
							});
							return;
						}
						const list = [];

					})
					.catch((error) => {
						uni.hideLoading()

						console.error("请求出错", error); // 处理任何错误
					});
			},
		}
	}
</script>

<style>
	.tab-item {
		font-size: 16px;
		cursor: pointer;
		position: relative;
	}

	.tab-item.active {
		font-size: 16px;
		color: #8ED0F2;
	}

	.tab-item.active::after {
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		bottom: 0;
		height: 2px;
		background-color: #8ED0F2;
	}
</style>